package com.jpa.entities;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "CTHD")
public class CtHd implements Serializable {
	private static final long serialVersionUID = -9157017657649426327L;

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "soHD", column = @Column(name = "MASP")),
			@AttributeOverride(name = "maSP", column = @Column(name = "SOHD")) })
	SanPhamHoaDonPK sanPhamHoaDon;

	@ManyToOne()
	@JoinColumn(name = "SOHD", nullable = false, insertable = false, updatable = false)
	private HoaDon hoaDon;

	@ManyToOne()
	@JoinColumn(name = "MASP", nullable = false, insertable = false, updatable = false)
	private SanPham sanPham;

	@Column(name = "SL")
	private int sL;

	public SanPhamHoaDonPK getSanPhamHoaDon() {
		return sanPhamHoaDon;
	}

	public void setSanPhamHoaDon(SanPhamHoaDonPK sanPhamHoaDon) {
		this.sanPhamHoaDon = sanPhamHoaDon;
	}

	public HoaDon getHoaDon() {
		return hoaDon;
	}

	public void setHoaDon(HoaDon hoaDon) {
		this.hoaDon = hoaDon;
	}

	public SanPham getSanPham() {
		return sanPham;
	}

	public void setSanPham(SanPham sanPham) {
		this.sanPham = sanPham;
	}

	public int getsL() {
		return sL;
	}

	public void setsL(int sL) {
		this.sL = sL;
	}

}
